
<?php slot('page_title','User Profiles - '.sfConfig::get('app_general_system_name')) ?>

<h1>Profiles for user: <?php echo $searchUser->getUsername() ?></h1>
<?php if ($userProfileMappings->count() > 0): ?>
    <table>
        <thead>
            <tr>
                <th>Profile</th>
                <th>Default</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
        <?php foreach ($userProfileMappings as $profileMapping): ?>
            <tr>
                <td>
                    <a href="<?php echo url_for('CollectionShow', array('uin' => $profileMapping->getCollectionItemUin())) ?>"><?php echo $profileMapping->getCollectionItem()->getCollectionName() ?></a>
                </td>
                <td>
                    <?php echo $profileMapping->getDefaultProfile()?'Yes':'No' ?>
                </td>
                <td>
                <?php if ($sf_user->hasCredential('edit-any-user-profile-link')): ?>
                    <a href="<?php echo url_for('ProfileUnlinkUserProfile', array('uin' => $profileMapping->getUin())) ?>">Unlink Profile</a>
                <?php endif; ?>
                </td>
            </tr>
        <?php endforeach; ?>
                </tbody>
            </table> 
<?php else: ?>
                        <p>No profiles found</p>
<?php endif; ?>
<?php if ($sf_user->hasCredential('edit-any-user-profile-link')): ?>
                            <h2>Add Profile</h2>
<?php include_partial('mappingForm', array('mappingUser' => $searchUser, 'form' => $addProfileMappingForm)) ?>
<?php endif; ?>